//
//  DDHotSaleCollectionHeaderView.m
//  Dingdong
//
//  Created by 程强 on 16/12/20.
//  Copyright © 2016年 程强. All rights reserved.
//

#import "DDHotSaleCollectionCustomeHeaderView.h"

@interface DDHotSaleCollectionCustomeHeaderView()
@property (strong, nonatomic) UIView *leftLine;
@property (strong, nonatomic) UIView *rightLine;
@end

@implementation DDHotSaleCollectionCustomeHeaderView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = RGBColor(244, 244, 244);
        self.titleLbl = [[KKLabel alloc]initWithBlock:^(KKLabel *lbl) {
            lbl.laText(@"",RGBColor(168, 168, 168),[UIFont systemFontOfSize:15.0],NSTextAlignmentCenter);
        }];
        [self addSubview:_titleLbl];
        [_titleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.centerY.equalTo(self);
            make.height.equalTo(@30);
            make.width.equalTo(@150);
        }];
        
        self.leftLine = [[UIView alloc]init];
        [self addSubview:_leftLine];
        _leftLine.backgroundColor = RGBColor(168, 168, 168);
        [_leftLine mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.height.equalTo(@1);
            make.left.equalTo(self).offset(10);
            make.right.equalTo(_titleLbl.mas_left).offset(-10);
        }];
        
        self.rightLine = [[UIView alloc]init];
        [self addSubview:_rightLine];
        _rightLine.backgroundColor = RGBColor(168, 168, 168);
        [_rightLine mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.height.equalTo(@1);
            make.left.equalTo(_titleLbl.mas_right).offset(10);
            make.right.equalTo(self).offset(-10);
        }];
        
        self.showLine = YES;
    }
    return self;
}
- (void)setTitle:(NSString *)title
{
    _title = title;
    _titleLbl.text = title;
}
- (void)setShowLine:(BOOL)showLine
{
    _showLine = showLine;
    if (showLine) {
        _leftLine.hidden = NO;
        _rightLine.hidden = NO;
    }else{
        _leftLine.hidden = YES;
        _rightLine.hidden = YES;
    }
}
@end
